/// 工具分类模型 - Tool Category Model
/// 
/// 根据后端JSON数据结构定义，用于数据转换
/// Defined based on backend JSON data structure for data conversion
class ToolCategory {
  final String? id;
  final String? name;
  final String? description;
  final String? iconUrl;
  final int? sortOrder;
  final bool? isActive;

  const ToolCategory({
    this.id,
    this.name,
    this.description,
    this.iconUrl,
    this.sortOrder,
    this.isActive,
  });

  /// 从JSON创建模型 - Create model from JSON
  factory ToolCategory.fromJson(Map<String, dynamic> json) {
    return ToolCategory(
      id: json['id']?.toString(),
      name: json['name']?.toString(),
      description: json['description']?.toString(),
      iconUrl: json['iconUrl']?.toString(),
      sortOrder: json['sortOrder']?.toInt(),
      isActive: json['isActive'],
    );
  }

  /// 转换为JSON - Convert to JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'description': description,
      'iconUrl': iconUrl,
      'sortOrder': sortOrder,
      'isActive': isActive,
    };
  }
}